package mdm.com.sap;

import java.util.Iterator;

import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.JCoField;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoTable;

public class GetCompany {

    public static void GetCompanyList(){
        try {
            JCoFunction function = RfcManager.getFunction("BAPI_COMPANY_GETLIST");
//            JCoParameterList importParam = function.getImportParameterList();
            function.execute(RfcManager.getDestination());
            JCoTable CompanyTable = function.getTableParameterList().getTable("COMPANY_LIST");
            Iterator<JCoField> jco=CompanyTable.iterator();
            while(jco.hasNext()) {
                JCoField next = jco.next();
                if(next!=null) {
                    System.out.println("key===="+next.getName()+"                 value===="+next.getValue());
                }
            }
//            for (int j = 0; j < CompanyTable.getNumRows(); j++) {
//                CompanyTable.setRow(j);
//                
//            }
        } catch (JCoException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
